package io.renren.modules.medical.entity;


import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.renren.common.validator.group.AddGroup;
import io.renren.common.validator.group.UpdateGroup;
import io.renren.modules.medical.validator.EnumValue;
import lombok.Data;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;

/**
 * @author Luo Sheng
 * @school YiBin university
 * @create 2023-03-30 16:10
 */
// 病情分类
@Data
@TableName("ill_sub")
public class IllSubEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @TableId(type = IdType.AUTO)
    @NotNull(message = "主键不能为空", groups = {UpdateGroup.class})
    @Null(message = "主键必须为空", groups = {AddGroup.class})
    private Long id;
    /**
     * 父id
     */
    @NotNull(message = "父级id不能为空", groups = {UpdateGroup.class, AddGroup.class})
    private Long parentId;
    /**
     * 病名
     */
    @NotBlank(message = "title不能为空", groups = {UpdateGroup.class, AddGroup.class})
    private String title;
    /**
     * 层级[1:第一层,2:第二层]
     */
    @EnumValue(intValues = {1, 2}, message = "层级只能为1、2层", groups = {UpdateGroup.class, AddGroup.class})
    private Integer subLevel;
    /**
     * 病情描述
     */
    @NotBlank(message = "病情描述不能为空", groups = {UpdateGroup.class, AddGroup.class})
    private String levelDescribe;
    /**
     * 排序字段
     */
    @Range(max = 100, min = 0, message = "排序字段只能为数字[0,100]", groups = {UpdateGroup.class, AddGroup.class})
    private Integer sort;

    /**
     * 逻辑删除
     */
    @JsonIgnore
    @TableLogic
    @TableField("is_deleted")
    private Integer isDeleted;
}
